package com.time.auth.infra.basic.service.impl;

import com.time.auth.common.utils.CollectionUtils;
import com.time.auth.infra.basic.entity.AuthRole;
import com.time.auth.infra.basic.mapper.AuthRoleDao;
import com.time.auth.infra.basic.service.AuthRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 角色服务实现类
 *
 * @author: HuangQi
 * @date: Created in 11:30 2025/9/25
 * @description: 角色服务实现类
 */
@Service("authRoleService")
public class AuthRoleServiceImpl implements AuthRoleService {

    @Autowired
    private AuthRoleDao authRoleDao;

    @Override
    public List<AuthRole> queryByRoleList(List<Long> roleIdList) {
        if (CollectionUtils.isEmpty(roleIdList)) {
            return List.of();
        }
        return this.authRoleDao.queryByRoleList(roleIdList);
    }

    @Override
    public Integer insert(AuthRole authRole) {
        return this.authRoleDao.insert(authRole);
    }

    @Override
    public Integer update(AuthRole authRole) {
        return this.authRoleDao.update(authRole);
    }

    @Override
    public AuthRole queryByCondtion(AuthRole authRole) {
        return this.authRoleDao.queryAllByLimit(authRole);
    }
}
